#ifndef CONFIG_H
#define CONFIG_H

#include <QFile>
#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonArray>
#include <QList>

struct liststr{
    QString name;
    QString path;
    QString icon;
};

enum JsonM{
    TOOL_JSON,
    HTTP_JSON,
    AI_JSON
};

class CONFIG
{
public:
    CONFIG();
    CONFIG(QString file);

    void getJson_from_file();

    void updataJson_to_File(QJsonDocument Jsondoc);

    void updataJson_to_File();

    void setFile_Path(QString path);

    void listToJson(JsonM type,QList <liststr> list);

    void configaddobj(QString name,QJsonObject Json);

    QJsonObject get_Json(JsonM type);

    QList <liststr> get_list(JsonM type);

private:
    QString filep;

    QJsonObject toolobj;
    QJsonObject httpobj;
    QJsonObject aiobj;

    QJsonObject config;

    QList <liststr> json_list;
};

#endif // CONFIG_H
